////////////////////////////////////////////////////////////////////////////////
// Filename: L_application.cpp
////////////////////////////////////////////////////////////////////////////////
#include "L_application.h"

L_Application::L_Application()
{
	Window = 0;
}

L_Application::~L_Application()
{

}

bool L_Application::Init(HINSTANCE hInstance, int nShowCmd, string Title)
{
	Window = new L_Window;
	if(!Window->Init(hInstance, nShowCmd, 800, 600, Title))
	{
		return false;
	}

	Graphics = new L_DX11Graphics;
	if(!Graphics->Init(Window->GetHwnd()))
	{
		return false;
	}

	return true;
}

void L_Application::Run()
{
	MSG msg;
	ZeroMemory(&msg, sizeof(MSG));
	while(true)
	{
		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			if (msg.message == WM_QUIT)
			{
				break;
			}
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		else
		{
			Graphics->Render();
		}
	}
}